{{extend './Layout/Layout.html'}}

{{block 'body'}}
<div class="auth-page" id="login">
    <div class="container page">
        <div class="row">
            <div class="col-md-6 offset-md-3 col-xs-12">
                <h1 class="text-xs-center">{{ isRegister ? "Register" : "Login" }}</h1>
                <p class="text-xs-center">
                    <a href="">Have an account?</a>
                </p>
                <form @submit.prevent="handleSubmit">
                    <fieldset class="form-group">
                        <input class="form-control form-control-lg" type="text" placeholder="Your Name"
                               v-model="user.username" name="username">
                        <ul class="error-messages">
                            <li v-for="(error,index) in username" :key="index">
                                {$ error.msg $}
                            </li>
                        </ul>
                    </fieldset>
                    {{ if isRegister }}
                    <fieldset class="form-group">
                        <input class="form-control form-control-lg" type="text" placeholder="Email" v-model="user.email"
                               name="email">
                        <ul class="error-messages">
                            <li v-for="(error,index) in email" :key="index">
                                {$ error.msg $}
                            </li>
                        </ul>
                    </fieldset>
                    {{ /if    }}
                    <fieldset class="form-group">
                        <input class="form-control form-control-lg" type="password" placeholder="Password"
                               v-model="user.password" name="password">
                        <ul class="error-messages">
                            <li v-for="(error,index) in password" :key="index">
                                {$ error.msg $}
                            </li>
                        </ul>
                    </fieldset>
                    <button class="btn btn-lg btn-primary pull-xs-right">
                        {{ isRegister ? "Register" : "Login" }}
                    </button>
                </form>
            </div>

        </div>
    </div>
</div>

{{/block}}

{{block 'js'}}
<script type="text/javascript" src={{isRegister ? "/public/JavaScript/User.js":"/public/JavaScript/Login.js"}}>

</script>
{{/block}}